#include <bits/stdc++.h>
using namespace std;
long long N, M;
long long A[100005];
map<long long, long long> memo;
int main() {
  cin >> N >> M;
  for (long long i = 0; i < N; i++) {
    cin >> A[i];
  }
  long long cur = 0;
  for (long long i = 0; i < N; i++) {
    cur += A[i];
    cur %= M;
    memo[cur]++;
  }
  long long ans = 0;
  for (auto m : memo) {
    cout << m.first << ":" << m.second << endl;
    ans += m.second * (m.second - 1) / 2;
    if (m.first == 0) {
      ans += m.second;
    }
  }
  cout << ans << endl;
}
