#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  string s;
  int low = 1, high = n;
  for (int i = 0; i < m; i++) {
    char d;
    int num;
    for (int q = 0; q < 5; q++) {
      cin >> s;
      if (q == 2) d = s[0];
      if (q == 4) num = stoi(s);
    }
    if (d == 'l') {
      if (high > num - 1) high = num - 1;
    } else {
      if (low < num + 1) low = num + 1;
    }
  }
  if (low > high)
    cout << -1 << '\n';
  else {
    cout << high - low + 1 << '\n';
  }
  return 0;
}
