#include <bits/stdc++.h>
using namespace std;
ofstream fout("b.txt");
ifstream fin("a.txt");
const int MOD = 1e9 + 7;
const int INFI = 1e9;
const int N = 11;
const int M = 1111;
const int move[8][2] = {1, 0, -1, 0, 0, 1, 0, -1, 1, 1, 1, -1, -1, 1, -1, -1};
char a[N], b[N], c[N], d[N];
int main() {
  int l, r, n, m, ans, t;
  while (cin >> n >> m) {
    l = n + 1;
    r = 0;
    for (int i = 0; i < m; i++) {
      cin >> a >> b >> c >> d >> t;
      if (!strcmp(c, "left"))
        l = min(l, t);
      else
        r = max(r, t);
    }
    ans = l - r - 1;
    if (ans <= 0)
      printf("%d\n", -1);
    else
      printf("%d\n", ans);
  }
  return 0;
}
