```
#include < bits / stdc++.h >
using namespace std;
long long maxSubArraySum(long long a[], long long size) {
int max_so_far = a[0];
int curr_max = a[0];
for (long long i = 1; i < size; i++) {
curr_max = max(a[i], curr_max + a[i]);
max_so_far = max(max_so_far, curr_max);
}
return max_so_far;
}
int main() {
int t;
cin >> t;
while (t--) {
int n, k;
cin >> n >> k;
long long a[n];
for (long long i = 0; i < n; i++) {
cin >> a[i];
}
long long b[n * k];
for (int i = 0; i < n * k; i++) {
b[i] = a[i % n];
}
cout << maxSubArraySum(b, n * k) << endl;
}
}
```

Using Kadane Algorithm But Showing Wrong Answer Even For The Subtask Anyone Can Help me understand that whether thier is a better way or its some implmentation error from my side. The following is a challenge live on codechef i would appreciate some suggestion and would request you not to upload whole code as i would like to be fair to myself.further a little more detailed explanation is highly appreciated