#include <bits/stdc++.h>
using namespace std;
int k, n, a[2200], b[2200], s[2200];
set<int> q, st;
vector<int> v;
bool u[2200];
int main() {
  cin >> k >> n;
  for (int i = 0; i < k; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  s[0] = a[0];
  sort(b, b + n);
  for (int i = 1; i < k; i++) s[i] = s[i - 1] + a[i];
  for (int i = 0; i < k; i++) q.insert(b[0] - s[i]);
  int ans = 0;
  for (auto i : q) v.push_back(i);
  int cur;
  for (auto j : v) {
    st.clear();
    for (int i = 0; i < k; i++) {
      cur = j + s[i];
      if (binary_search(b, b + n, cur)) st.insert(cur);
    }
    if (st.size() == n) ++ans;
  }
  cout << ans;
  return 0;
}
