#include <bits/stdc++.h>
using namespace std;
const int MX = 500020;
const int N = 1000060;
const int mood = ((int)1e9 + 7);
int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  cin.ignore();
  int res = n;
  int l = 1, r = n;
  for (int i = 0; i < m; ++i) {
    string s;
    getline(cin, s);
    bool lf = s.find("left") != string::npos;
    int idx = 0;
    int j = (int)s.size() - 1;
    int b = 1;
    while (s[j] != ' ') idx += b * (s[j--] - '0'), b *= 10;
    if (lf)
      r = min(r, idx - 1);
    else
      l = max(l, idx + 1);
    if (l > r) return puts("-1"), 0;
  }
  cout << r - l + 1 << endl;
  return 0;
}
