#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
long long inv(long long a, long long b) {
  return a - 1 ? b - b * inv(b % a, a) / a : 1;
}
int main() {
  long long t, n;
  scanf("%lld %lld", &t, &n);
  vector<long long> as(n);
  scanf("%lld", &as[n - 1]);
  for (int i = 1; i < (n); ++i) scanf("%lld", &as[i - 1]);
  vector<long long> pre(n + 1);
  for (int i = 0; i < (n); ++i) pre[i + 1] = pre[i] + as[i];
  long long sum = pre[n];
  long long d = gcd(sum, t);
  sum /= d, t /= d;
  long long mus = t == 1 ? 1 : inv(sum % t, t);
  map<long long, vector<long long> > gs;
  for (int i = 0; i < (n); ++i) gs[pre[i] % d].push_back(i);
  vector<long long> ans(n, -1);
  for (auto &v : gs) {
    vector<long long> u;
    for (auto &x : v.second) u.push_back(pre[x] / d);
    for (auto &x : u) x = x % t * mus % t;
    vector<pair<long long, long long> > pas;
    for (int i = 0; i < ((int)(v.second).size()); ++i)
      pas.emplace_back(u[i], -v.second[i]);
    sort(pas.begin(), pas.end());
    pas.push_back(pas[0]);
    pas.back().first += t;
    for (int i = 0; i < ((int)(pas).size() - 1); ++i)
      ans[-pas[i].second] = pas[i + 1].first - pas[i].first;
  }
  for (auto &x : ans) assert(x != -1);
  for (auto &x : ans) printf("%lld ", x);
  puts("");
}
