#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>
#include <cassert>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using uInt = long long unsigned int;
using Double = long double;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//edit
class RollingHash {
public:
    vector<Int> mods = {1000000007, 998244353};
//    Int base = 10007;
    vector<vector<Int>> hashes; // hashes[i][j] = s[0,i]のmod
    vector<vector<Int>> pows;

    Int mul(Int a, Int b, Int m) const {
        return a * b % m;
    }

    RollingHash(const string &s, Int base = 10007) {
        hashes.resize(s.size() + 1, vector<Int>(mods.size()));
        pows.resize(s.size() + 1, vector<Int>(mods.size()));

        for (int j = 0; j < mods.size(); ++j) {
            pows[0][j] = 1;
        }

        for (int i = 0; i < s.size(); ++i) {
            for (int j = 0; j < mods.size(); ++j) {
                hashes[i + 1][j] = mul(hashes[i][j], base, mods[j]) + s[i];
                pows[i + 1][j] = mul(pows[i][j], base, mods[j]);
                if (hashes[i + 1][j] >= mods[j]) {
                    hashes[i + 1][j] -= mods[j];
                }
            }
        }
    }

    // s[l, r)のハッシュ値
    vector<Int> get(Int l, Int r) const {
        vector<Int> ret(mods.size());
        for (int i = 0; i < mods.size(); ++i) {
            ret[i] = hashes[r][i] - mul(hashes[l][i], pows[r - l][i], mods[i]);
            if (ret[i] < 0) {
                ret[i] += mods[i];
            }
        }

        return ret;
    }

};


class Solve {
public:
    void solve() {
        Int n, m;
        cin >> n >> m;
        string s;
        cin >> s;
        set<vector<Int>> st;
        Int l = 0, r = 1;
        RollingHash rh(s);
        for (int i = 0; i < m; ++i) {
            string t;
            cin >> t;
            Int add = t[2] == '+' ? 1 : -1;
            if (t[0] == 'R') {
                r += add;
            } else {
                l += add;
            }
            auto tapu = rh.get(l, r);
            st.insert(tapu);
        }

        cout << st.size() << endl;
    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
//    std::ifstream in("input.txt");
//    std::cin.rdbuf(in.rdbuf());

    Solve().solve();


    return 0;
}



Measured memory_bytes: 63960