#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  int a[1000000];
  for (int i = 0; i < N; i++) cin >> a[i];
  long long count = 0;
  for (int i = 0; i < N; i++) {
    int now = 0;
    for (int j = i; j < N; j++) {
      now = (now + a[j]) % M;
      if (now == 0) count++;
    }
  }
  cout << count << endl;
}
