#include <bits/stdc++.h>
using ll = long long;
using ld = long double;
using namespace std;
const int MAXN = 300001;
int a[MAXN];
int gcd2(int x, int y, int& xa, int& ya) {
  if (y == 0) {
    xa = 1;
    ya = 0;
    return x;
  }
  int d = x / y;
  int res = gcd2(y, x % y, ya, xa);
  ya -= d * xa;
  return res;
}
map<int, vector<pair<int, int> > > mp;
int ans[MAXN];
set<int> alr;
bool w[MAXN];
pair<int, int> cur[MAXN];
int main() {
  ios_base::sync_with_stdio(false);
  cout.setf(ios::fixed);
  cout.precision(20);
  int n, t;
  cin >> t >> n;
  a[0] = 0;
  int fs;
  cin >> fs;
  for (int i = 1; i < n; i++) {
    cin >> a[i];
    a[i] = (a[i] + a[i - 1]) % t;
  }
  for (int i = 0; i < n; i++) {
    w[i] = (alr.find(a[i]) == alr.end());
    if (w[i]) alr.insert(a[i]);
  }
  a[n] = (fs + a[n - 1]) % t;
  int xa, ya;
  int g = gcd2(a[n], t, xa, ya);
  int k = a[n] / g;
  t /= g;
  gcd2(k, t, xa, ya);
  if (xa < 0) xa += t;
  for (int i = 0; i < n; i++) {
    ans[i] = 0;
    if (w[i]) mp[a[i] % g].emplace_back(a[i] / g, i);
  }
  for (auto& p : mp) {
    auto& vc = p.second;
    int sz = vc.size();
    for (int i = 0; i < sz; i++) {
      cur[i] = {(ll(vc[i].first) * xa) % t, vc[i].second};
    }
    sort(cur, cur + sz);
    for (int i = 1; i < sz; i++) {
      ans[cur[i - 1].second] = cur[i].first - cur[i - 1].first;
    }
    ans[cur[sz - 1].second] = cur[0].first - cur[sz - 1].first + t;
  }
  for (int i = 0; i < n; i++) cout << ans[i] << " ";
  cout << endl;
  return 0;
}
