#include <bits/stdc++.h>
using namespace std;
int b[2007], n, k, a, x = 0, ans = 0;
set<int> s;
unordered_map<int, int> m;
int main() {
  scanf("%d%d", &k, &n);
  for (int i = 0; i < k; i++) scanf("%d", &a), x += a, s.insert(x);
  for (int i = 0; i < n; i++) scanf("%d", b + i);
  for (int i = 0; i < n; i++)
    for (int e : s) ++m[b[i] - e], ans += (m[b[i] - e] == n);
  cout << ans;
}
