#include #include #include #include #define rep(i,n) for(int i=0;i> s; int m; cin >> m; vector c(m); rep(i,m) cin >> c[i]; RollingHash roll(s); int res = 0; rep(i,m) res += roll.count_contain(c[i]); cout << res << "\n"; return 0; }