#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int l = 1, r = n;
  string s1, s2;
  int w;
  for (int i = 0; i < m; ++i) {
    cin >> s2;
    cin >> s2;
    cin >> s1;
    cin >> s2;
    cin >> w;
    if (s1 == "left" && r > w - 1) r = w - 1;
    if (s1 == "right" && l < w + 1) l = w + 1;
  }
  if (r < l)
    cout << "-1\n";
  else
    cout << r - l + 1 << endl;
  return 0;
}
