#include <bits/stdc++.h>
template <typename T>
std::ostream& operator<<(std::ostream& os, const std::vector<T> v) {
  os << "{";
  for (auto el : v) {
    os << el << ", ";
  }
  return os << "}";
}
int main() {
  int n, k;
  std::cin >> k >> n;
  std::vector<int> v(k), u(n), sums(k);
  std::unordered_map<int, int> m;
  for (int i = 0; i < k; ++i) {
    std::cin >> v[i];
  }
  sums[0] = v[0];
  for (int i = 1; i < k; ++i) {
    sums[i] = sums[i - 1] + v[i];
  }
  for (int i = 0; i < n; ++i) {
    std::cin >> u[i];
  }
  for (int i = 0; i < k; ++i) {
    m[u[0] - sums[i]] = 1;
  }
  for (int i = 1; i < n; ++i) {
    std::unordered_map<int, int> cur;
    for (int j = 0; j < k; ++j) {
      int el = u[i] - sums[j];
      if (m.count(el)) {
        cur[el] += 1;
        if (cur[el] == 1) {
          m[el] += 1;
        }
      }
    }
  }
  int count = 0;
  for (auto it : m) {
    if (it.second == u.size()) {
      ++count;
    }
  }
  std::cout << count << std::endl;
  return 0;
}
