#include <bits/stdc++.h>
using namespace std;
long long n, t, arr[200042];
long long s, st[200042], g;
struct e {
  long long p, q, ind;
  e(long long p_ = 0, long long q_ = 0, long long ind_ = 0) {
    p = p_;
    q = q_;
    ind = ind_;
  }
};
bool cmp(e a, e b) {
  if (a.p != b.p) {
    return a.p < b.p;
  }
  if (a.q != b.q) {
    return a.q < b.q;
  }
  return a.ind > b.ind;
}
vector<e> v;
long long ans[2000042];
long long gcd(long long a, long long b) {
  if (a == 0) {
    return b;
  }
  return gcd(b % a, a);
}
long long exgcd(long long a, long long b, long long &x, long long &y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  long long cx, cy;
  long long ret = exgcd(b % a, a, cx, cy);
  x = cy - b / a * cx;
  y = cx;
  return ret;
}
int main() {
  cin >> t >> n;
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
    arr[i] %= t;
    s += arr[i];
  }
  for (long long i = 1; i < n; i++) {
    st[i] = st[i - 1] + arr[i];
    st[i] %= t;
  }
  g = gcd(s, t);
  long long cx, cy;
  exgcd(s, t, cx, cy);
  for (long long i = 0; i < n; i++) {
    long long p = st[i] % g, q = st[i];
    q -= p;
    long long x, y;
    x = cx * q;
    y = cy * q;
    while (x < 0) {
      x += (1 << 20) * t;
    }
    x %= t;
    v.push_back(e(p, x, i));
  }
  sort(v.begin(), v.end(), cmp);
  for (long long i = 0; i < v.size();) {
    long long j = i;
    for (; j < v.size() && v[i].p == v[j].p; j++) {
    }
    for (long long c = i; c < j - 1; c++) {
      ans[v[c].ind] = (v[c + 1].q - v[c].q) / g;
    }
    ans[v[j - 1].ind] = (t - v[j - 1].q + v[i].q) / g;
    i = j;
  }
  for (long long i = 0; i < n; i++) {
    cout << ans[i] << " ";
  }
  cout << "\n";
  return 0;
}
