#include <bits/stdc++.h>
using namespace std;
inline long long rd() {
  long long x = 0;
  int ch = getchar(), f = 1;
  while (!isdigit(ch) && (ch != '-') && (ch != EOF)) ch = getchar();
  if (ch == '-') {
    f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 1) + (x << 3) + ch - '0';
    ch = getchar();
  }
  return x * f;
}
inline void rt(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10)
    rt(x / 10), putchar(x % 10 + '0');
  else
    putchar(x + '0');
}
const int maxn = 200005;
int T, n, a[maxn];
map<int, int> mp;
struct astr {
  int mo, id, blt;
  astr(int a = 0, int b = 0, int c = 0) { mo = a, id = b, blt = c; }
  bool operator<(const astr& x) const {
    return mo == x.mo ? id < x.id : mo < x.mo;
  }
} c[maxn];
int cnt;
int gcd(int a, int b) { return !b ? a : gcd(b, a % b); }
int phi(int x) {
  int ret = x;
  for (int i = 2; i * i <= x; i++)
    if (x % i == 0) {
      ret = ret / i * (i - 1);
      while (x % i == 0) x /= i;
    }
  if (x != 1) ret = ret / x * (x - 1);
  return ret;
}
int qpow(int a, int b, int p) {
  int ret = 1;
  for (; b; b >>= 1, a = (long long)a * a % p)
    if (b & 1) ret = (long long)ret * a % p;
  return ret;
}
int ans[maxn];
int main() {
  T = rd(), n = rd();
  for (int i = int(1); i <= (int)(n); i++) a[i] = rd();
  int nw = -a[1];
  for (int i = int(1); i <= (int)(n); i++) {
    nw = (nw + a[i]) % T;
    if (!mp.count(nw)) mp[nw] = i;
  }
  nw = (nw + a[1]) % T;
  int g = gcd(nw, T), len = T / g, stp = nw / g,
      inv = qpow(stp, phi(len) - 1, len);
  nw = -a[1];
  for (int i = int(1); i <= (int)(n); i++) {
    nw = (nw + a[i]) % T;
    if (mp[nw] == i)
      c[++cnt] = astr(nw % g, (long long)(nw / g) * inv % len, i);
  }
  sort(c + 1, c + cnt + 1);
  for (int i = int(1); i <= (int)(cnt); i++) {
    int j = i;
    while (j < cnt && c[j + 1].mo == c[j].mo) j++;
    for (int k = int(i); k <= (int)(j - 1); k++)
      ans[c[k].blt] += c[k + 1].id - c[k].id;
    ans[c[j].blt] += c[i].id + len - c[j].id;
    i = j;
  }
  for (int i = int(1); i <= (int)(n); i++) rt(ans[i]), putchar(' ');
  putchar('\n');
}
