#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, k, l, n, m, cn;
  int ar[2000];
  string a, b, c, d;
  while (cin >> n >> m) {
    memset(ar, 0, sizeof(ar));
    cn = 0;
    for (i = 0; i < m; i++) {
      cin >> a >> b >> c >> d >> k;
      if (c == "left") {
        for (j = k - 1; j; j--) ar[j]++;
      } else {
        for (j = k + 1; j <= n; j++) ar[j]++;
      }
    }
    for (i = 1; i < n + 1; i++)
      if (ar[i] == m) cn++;
    if (cn)
      cout << cn << endl;
    else
      cout << -1 << endl;
  }
  return 0;
}
