#include <bits/stdc++.h>
using namespace std;
int n, m, ans;
const int maxn = 1e5 + 5;
int a[maxn], sum[maxn];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    sum[i] = (sum[i - 1] + a[i]) % m;
    if (sum[i] == 0) ans++;
  }
  for (int i = 1; i < n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if ((sum[j] - sum[i]) == 0) ans++;
    }
  }
  cout << ans;
  return 0;
}
