#include <bits/stdc++.h>
using namespace std;
int a[100000001];
int n, m;
int x;
int ans = 0;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    a[i] = (a[i - 1] + x) % m;
  }
  for (int i = 1; i <= n; i++)
    for (int j = i; j <= n; j++) {
      if (i == j) {
        x = a[i] - a[i - 1];
        if (x % m == 0) ans++;
      } else {
        x = a[j] - a[i - 1];
        if (x % m == 0) ans++;
      }
    }
  cout << ans << endl;
}
