#include <bits/stdc++.h>
struct tok {
  long long t, w, id;
} a[200000];
int N;
long long T, L, G, O[200000];
long long gcd(long long x, long long y) {
  long long r;
  while (y) {
    r = x % y;
    x = y;
    y = r;
  }
  return x;
}
long long PHI(long long x) {
  long long r = x;
  for (long long i = 2; i * i <= x; i++)
    if (x % i == 0) {
      r = r / i * (i - 1);
      do x /= i;
      while (x % i == 0);
    }
  if (x > 1) r = r / x * (x - 1);
  return r;
}
long long POWER(long long a, long long b, long long c) {
  long long r = 1;
  for (; b; b >>= 1) {
    if (b & 1) r = r * a % c;
    a = a * a % c;
  }
  return r;
}
int main() {
  scanf("%lld%d", &T, &N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &a[i].t);
    a[i].id = i;
    L += a[i].t;
  }
  a[0].t = 0;
  for (int i = 1; i < N; i++) a[i].t += a[i - 1].t;
  G = gcd(T, L);
  T /= G;
  L /= G;
  long long __Inv = POWER(L % T, PHI(T) - 1, T);
  for (int i = 0; i < N; i++) {
    a[i].w = a[i].t / G % T * __Inv % T;
    a[i].t %= G;
  }
  std::sort(a, a + N, [](const tok &x, const tok &y) {
    return x.t < y.t ||
           (x.t == y.t && (x.w < y.w || (x.w == y.w && x.id > y.id)));
  });
  for (int i = 0, j; i < N; i = j) {
    j = i + 1;
    while (j < N && a[i].t == a[j].t) j++;
    for (int k = i + 1; k < j; k++) O[a[k - 1].id] = a[k].w - a[k - 1].w;
    O[a[j - 1].id] = a[i].w - a[j - 1].w + T;
  }
  for (int i = 0; i < N; i++) printf("%lld%c", O[i], " \n"[i == N - 1]);
  return 0;
}
