#include <bits/stdc++.h>
using namespace std;
void wait() {
  getchar();
  getchar();
}
int main() {
  int n, m;
  cin >> n >> m;
  int l = 1, r = n;
  for (int i = 0; i < m; i++) {
    string a, b, c, d;
    int num;
    cin >> a >> b >> c >> d >> num;
    if (c == "left") {
      if (num <= r) r = num - 1;
    }
    if (c == "right") {
      if (num >= l) l = num + 1;
    }
    if (l > r) {
      cout << -1;
      wait();
      return 0;
    }
  }
  cout << r - l + 1;
  wait();
}
