#include <bits/stdc++.h>
using namespace std;
inline long long toInt(string s) {
  long long v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
std::vector<std::string> split(std::string str, set<char> del) {
  std::vector<std::string> result;
  std::string subStr;
  for (const char c : str) {
    if (((del).find(c) != (del).end())) {
      result.push_back(subStr);
      subStr.clear();
    } else {
      subStr += c;
    }
  }
  result.push_back(subStr);
  return result;
}
const double EPS = 1e-10;
const double PI = acos(-1.0);
template <class T>
void showVector(vector<T>& v) {
  for (int i = 0; i < v.size(); ++i) cerr << v[i] << " ";
  cerr << endl;
}
const long long mod = 1000000007;
long long mod_pow(long long x, long long n, long long mod) {
  if (n == 0) {
    return 1;
  }
  long long res = mod_pow(x * x % mod, n / 2, mod);
  if (n & 1) {
    res = res * x % mod;
  }
  return res;
}
long long conbination(long long n, long long r) {
  if (r > n || r < 0LL) {
    return 0LL;
  }
  long long i;
  long long s = 1LL;
  for (i = 1LL; i <= r; i++) {
    s = s * (n + 1LL - i) / i;
  }
  return s;
}
int popcount(int a) { return __builtin_popcount(a); }
long long gcd(long long a, long long b) {
  if (a % b == 0) {
    return b;
  } else
    return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
template <class T>
class matrix : public vector<vector<T> > {
 private:
  int tate_, yoko_;

 public:
  matrix(const int tate__, const int yoko__) {
    ((void)0);
    ((void)0);
    this->resize(tate__);
    for (size_t i = 0; i < this->size(); i++) {
      (*this)[i].resize(yoko__);
    }
    tate_ = tate__;
    yoko_ = yoko__;
  }
  matrix(){};
  int tate() const { return tate_; }
  int yoko() const { return yoko_; }
  void resizematrix(const int tate__, const int yoko__) {
    ((void)0);
    ((void)0);
    this->resize(tate__);
    for (size_t i = 0; i < this->size(); i++) {
      (*this)[i].resize(yoko__);
    }
    tate_ = tate__;
    yoko_ = yoko__;
  }
  void setzero() {
    for (int i = 0; i < tate(); i++)
      for (int j = 0; j < yoko(); j++) {
        (*this)[i][j] = 0;
      }
  }
};
template <class T>
std::ostream& operator<<(std::ostream& os, const matrix<T>& m) {
  for (int j = 0; j < m.tate(); j++) {
    for (int i = 0; i < m.yoko(); i++) {
      os << (int)m[j][i];
    }
    os << endl;
  }
  return os;
}
long long starttime;
inline long long now() {
  struct timeval tv;
  gettimeofday(&tv, NULL);
  long long t = tv.tv_sec * 1000LL + tv.tv_usec / 1000LL;
  return t;
}
inline long long elapsed() { return now() - starttime; }
class BIT {
 public:
  std::vector<long long> bit;
  int n;
  BIT(){};
  BIT(int N) {
    n = N;
    bit.assign(n + 2, 0);
  }
  long long sum(long long i) {
    long long s = 0LL;
    while (i > 0LL) {
      s += bit[i];
      i -= i & -i;
    }
    return s;
  }
  long long sum_0indexed(long long i) { return sum(i + 1); }
  void add(long long i, long long x) {
    while (i <= n) {
      bit[i] += x;
      i += i & -i;
    }
  }
  void add_0indexed(long long i, long long x) { add(i + 1, x); }
  long long rangesum(int from, int to) {
    if (from == 0) {
      return sum(to);
    } else {
      return sum(to) - sum(from - 1);
    }
  }
  long long rangesum_0indexed(int from, int to) {
    return sum(to + 1) - sum(from);
  }
};
int main() {
  long long n, m;
  cin >> n >> m;
  BIT bit(n);
  for (int i = (0); i < (n); ++i) {
    long long s;
    cin >> s;
    bit.add_0indexed(i, s);
  }
  long long num = 0;
  for (int l = (0); l < (n); ++l)
    for (int r = (l); r < (n); ++r) {
      long long sum = bit.rangesum_0indexed(l, r);
      num += (sum % m == 0);
    }
  cout << num << endl;
}
