def solve():
n, q = map(int, input().split()) # Number of snakes and events
events = [input().strip() for _ in range(q)] # List of events
# Initialize the snake positions: all snakes start in their own cell, so (1, 1) for each snake.
snakes = [(1, 1)] * n # List of tuples representing the (left, right) positions of each snake.
# Set to track occupied cells to avoid collisions
occupied = set(range(1, n + 1)) # Initially, each snake occupies one cell from 1 to n
# To keep track of the maximum occupied cell after each step
max_occupied = n # Initially, the maximum occupied cell is n (since the snakes occupy 1 to n).
# Process each event
for event in events:
snake_idx = int(event[0]) - 1 # Snake index is 1-based, so we adjust to 0-based.
if event[2] == '+': # Grow the snake
# Current position of the snake
left, right = snakes[snake_idx]
# Try to grow the snake
new_right = right + 1
if new_right not in occupied:
# Update snake's position and mark new cell as occupied
snakes[snake_idx] = (left, new_right)
occupied.add(new_right)
# Update max_occupied
max_occupied = max(max_occupied, new_right)
elif event[2] == '-': # Shrink the snake
# Current position of the snake
left, right = snakes[snake_idx]
# Try to shrink the snake
new_left = left + 1
# Update snake's position
snakes[snake_idx] = (new_left, right)
# Mark the cell we just freed as unoccupied
occupied.remove(left)
# Output the minimum possible score (maximum occupied cell after all events)
print(max_occupied)
ZGVmIHNvbHZlKCk6CiAgICBuLCBxID0gbWFwKGludCwgaW5wdXQoKS5zcGxpdCgpKSAgIyBOdW1iZXIgb2Ygc25ha2VzIGFuZCBldmVudHMKICAgIGV2ZW50cyA9IFtpbnB1dCgpLnN0cmlwKCkgZm9yIF8gaW4gcmFuZ2UocSldICAjIExpc3Qgb2YgZXZlbnRzCiAgICAKICAgICMgSW5pdGlhbGl6ZSB0aGUgc25ha2UgcG9zaXRpb25zOiBhbGwgc25ha2VzIHN0YXJ0IGluIHRoZWlyIG93biBjZWxsLCBzbyAoMSwgMSkgZm9yIGVhY2ggc25ha2UuCiAgICBzbmFrZXMgPSBbKDEsIDEpXSAqIG4gICMgTGlzdCBvZiB0dXBsZXMgcmVwcmVzZW50aW5nIHRoZSAobGVmdCwgcmlnaHQpIHBvc2l0aW9ucyBvZiBlYWNo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h0KQogICAgICAgICAgICAgICAgb2NjdXBpZWQuYWRkKG5ld19yaWdodCkKICAgICAgICAgICAgICAgICMgVXBkYXRlIG1heF9vY2N1cGllZAogICAgICAgICAgICAgICAgbWF4X29jY3VwaWVkID0gbWF4KG1heF9vY2N1cGllZCwgbmV3X3JpZ2h0KQogICAgICAgIGVsaWYgZXZlbnRbMl0gPT0gJy0nOiAgIyBTaHJpbmsgdGhlIHNuYWtlCiAgICAgICAgICAgICMgQ3VycmVudCBwb3NpdGlvbiBvZiB0aGUgc25ha2UKICAgICAgICAgICAgbGVmdCwgcmlnaHQgPSBzbmFrZXNbc25ha2VfaWR4XQogICAgICAgICAgICAjIFRyeSB0byBzaHJpbmsgdGhlIHNuYWtlCiAgICAgICAgICAgIG5ld19sZWZ0ID0gbGVmdCArIDEKICAgICAgICAgICAgIyBVcGRhdGUgc25ha2UncyBwb3NpdGlvbgogICAgICAgICAgICBzbmFrZXNbc25ha2VfaWR4XSA9IChuZXdfbGVmdCwgcmlnaHQpCiAgICAgICAgICAgICMgTWFyayB0aGUgY2VsbCB3ZSBqdXN0IGZyZWVkIGFzIHVub2NjdXBpZWQKICAgICAgICAgICAgb2NjdXBpZWQucmVtb3ZlKGxlZnQpCiAgICAKICAgICMgT3V0cHV0IHRoZSBtaW5pbXVtIHBvc3NpYmxlIHNjb3JlIChtYXhpbXVtIG9jY3VwaWVkIGNlbGwgYWZ0ZXIgYWxsIGV2ZW50cykKICAgIHByaW50KG1heF9vY2N1cGllZCkK