#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  int num;
  int flag;
  int val;
  int t;
  int sig = 0;
  char ch[10];
  int count;
  vector<int> v;
  string s, s1;
  cin >> n >> m;
  for (int i = 0; i <= n; i++) v.push_back(i);
  cin.ignore(256, '\n');
  while (m--) {
    t = 0;
    getline(cin, s);
    flag = s.find("left");
    if (flag == -1) {
      s.find("right");
      s1 = s.substr(16, s[s.size() - 1]);
      t = 1;
    } else {
      s1 = s.substr(15, s[s.size() - 1]);
      t = 0;
    }
    int i = 0;
    for (i = 0; i < s1.size(); i++) {
      ch[i] = s1[i];
    }
    ch[i] = '\0';
    val = atoi(ch);
    if (t == 1) {
      for (int j = 0; j <= val; j++) v[j] = 0;
    } else if (t == 0) {
      for (int j = val; j <= n; j++) v[j] = 0;
    }
  }
  count = 0;
  for (int i = 1; i <= n; i++) {
    if (v[i] != 0) count++;
  }
  if (count == 0) count = -1;
  cout << count << endl;
  ;
  return 0;
}
