Help me in solving SUMARRAY problem

My issue

Can anyone explain to me why I am getting this as an output: 100000 100001
for this input: 1
2 200001

if I have the following condition in my code:
void solve() {
ll n, k;
cin >> n >> k;
ll arr [n];
ll sum = 3n/2;
ll max = n
10E5 -n/2;
ll diff = k - sum;

if (k < sum || k > max) {
    cout << -1 << endl; return;
} ..... 

My code

#include <bits/stdc++.h>
using namespace std;
#define ll long long 

void solve();

int main()
{
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}

void solve() {
    ll n, k;
    cin >> n >> k;
    ll arr [n];
    ll sum = 3*n/2;
    ll max = n*10E5 -n/2;
    ll diff = k - sum;

    if (k < sum || k > max) {
        cout << -1 << endl; return;
    }

    if (diff % 2 != 0) {
        cout << -1 << endl;
        return;
    }

    for (int i = 0; i < n; ++i) {
        if (i%2 == 0) arr[i] = 1;
        else arr[i] = 2;
    }

    ll add = diff/n;
    ll rest = diff%n; //to add all of diff to the array
    for (ll i = 0; i < n; i++) arr[i]+=add;
    for (ll i = 0; i < rest; i++) arr[i]++;
    for (ll i = 0; i < n; i++) cout << arr[i] << " ";
}

Problem Link: SUMARRAY Problem - CodeChef

@royalmadhatter
for test case
1
2 200001
your code prints
100000 100001
which is not right cozz all the values of arr[i] must lie between 1 and 10^5.
its correct answer should be -1;