#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x;
  string s1, s2;
  bool p[1001];
  cin >> n >> m;
  for (int i = 0; i < n; i++) p[i] = 1;
  for (int i = 0; i < m; i++) {
    cin >> s1 >> s1 >> s2 >> s1 >> x;
    if (s2 == "left")
      for (int i = x - 1; i < n; i++) p[i] = 0;
    else
      for (int i = 0; i < x; i++) p[i] = 0;
  }
  int s = 0;
  for (int i = 0; i < n; i++) s += p[i];
  if (s)
    cout << s;
  else
    cout << -1;
  return 0;
}
