#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i, d, l, r;
  string s, t;
  cin >> n >> m;
  l = 1, r = n;
  for (i = 1; i <= m; i++) {
    cin >> t >> t >> s >> t >> d;
    if (s == "left")
      r = min(r, d - 1);
    else
      l = max(l, d + 1);
  }
  cout << (l <= r ? r - l + 1 : -1) << endl;
}
