#include <bits/stdc++.h>
using namespace std;
long long A[200010], S[200010], D[200010], M[200010], W[200010], Ans[200010],
    ord[200010], s, g, n, r, T;
long long gcd(long long x, long long y) { return !y ? x : gcd(y, x % y); }
bool cmp(int x, int y) {
  return M[x] < M[y] || M[x] == M[y] && D[x] < D[y] ||
         M[x] == M[y] && D[x] == D[y] && S[x] > S[y];
}
void exgcd(long long x, long long& a, long long y, long long& b) {
  if (!y) {
    a = 1, b = 0;
    return;
  }
  exgcd(y, b, x % y, a), b -= x / y * a;
}
long long rev(long long x, long long y) {
  long long a, b;
  exgcd(x, a, y, b);
  return (a % y + y) % y;
}
set<long long> hsh;
int main() {
  scanf("%lld%lld", &T, &n);
  for (int i = 1; i <= n; i++) scanf("%lld", &A[i]), ord[i] = i;
  for (int i = 2; i <= n; i++) S[i] = S[i - 1] + A[i];
  if (!(s = (S[n] + A[1]) % T)) {
    for (int i = 1; i <= n; i++)
      if (!hsh.count(S[i] % T)) hsh.insert(S[i] % T), Ans[i] = 1;
  } else {
    g = gcd(s, T), r = rev(s / g, T / g);
    for (int i = 1; i <= n; i++)
      D[i] = ((S[i] % T) / g) * r % (T / g), M[i] = S[i] % g, W[i] = 1;
    sort(ord + 1, ord + n + 1, cmp);
    for (int i = 1, nxt = 1; i <= n; i = ++nxt) {
      while (nxt != n && M[ord[nxt]] == M[ord[nxt + 1]]) nxt++;
      for (int j = i; j < nxt; j++) Ans[ord[j]] = D[ord[j + 1]] - D[ord[j]];
      Ans[ord[nxt]] = T / g - D[ord[nxt]] + D[ord[i]];
    }
  }
  for (int i = 1; i < n; i++) printf("%lld ", Ans[i]);
  return printf("%lld\n", Ans[n]), 0;
}
