#include <bits/stdc++.h>
using namespace std;
int an[200000], T, n, inv;
long long s;
vector<pair<int, int> > x;
set<int> vis;
map<int, vector<pair<int, int> > > mp;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
int pw(long long x, long long p, int md) {
  int an = 1;
  x %= md;
  while (p) {
    if (p & 1) an = (long long)an * x % md;
    x = (long long)x * x % md;
    p >>= 1;
  }
  return an;
}
int X;
bool cmp(pair<int, int> const &a, pair<int, int> const &b) {
  int z1 = a.first - X, z2 = b.first - X;
  if (z1 < 0) z1 += T;
  if (z2 < 0) z2 += T;
  int d1 = (long long)z1 * inv % T, d2 = (long long)z2 * inv % T;
  return d1 < d2;
}
int phi(int x) {
  int an = x;
  for (int i = 2; i * i <= x; ++i)
    if (x % i == 0) {
      x /= i;
      while (x % i == 0) x /= i;
      an = an / i * (i - 1);
    }
  if (x > 1) an = an / x * (x - 1);
  return an;
}
int main() {
  int tmp;
  scanf("%d%d%d", &T, &n, &tmp);
  int z = 0;
  for (int i = 0; i < (int)(n - 1); ++i) {
    if (vis.find(z) == vis.end()) x.push_back(make_pair(z, i)), vis.insert(z);
    int t;
    scanf("%d", &t);
    z = (z + t) % T;
    s += t;
  }
  if (vis.find(z) == vis.end()) x.push_back(make_pair(z, n - 1));
  s += tmp;
  int g = gcd(T, s);
  T /= g;
  s /= g;
  inv = pw(s, phi(T) - 1, T);
  for (int i = 0; i < (int)(x.size()); ++i)
    mp[x[i].first % g].push_back(make_pair(x[i].first / g, x[i].second));
  for (map<int, vector<pair<int, int> > >::iterator it = mp.begin();
       it != mp.end(); ++it) {
    vector<pair<int, int> > &v = it->second;
    X = v[0].first;
    sort(v.begin() + 1, v.end(), cmp);
    for (int i = 1; i < (int)(v.size()); ++i) {
      int z = v[i].first - v[i - 1].first;
      if (z < 0) z += T;
      int d = (long long)z * inv % T;
      if (d == 0) d = T;
      an[v[i - 1].second] += d;
    }
    int z = v[0].first - v.back().first;
    if (z < 0) z += T;
    int d = (long long)z * inv % T;
    if (d == 0) d = T;
    an[v.back().second] += d;
  }
  printf("%d", an[0]);
  for (int i = 1; i < (int)(n); ++i) printf(" %d", an[i]);
  printf("\n");
}
