#import <Foundation/Foundation.h>

int main(void){
    
    NSData   *allData = [[NSFileHandle fileHandleWithStandardInput] readDataToEndOfFile];
    NSString *allText = [[NSString alloc]
                         initWithBytes:[allData bytes]
                         length:[allData length]
                         encoding:NSUTF8StringEncoding];
    NSArray *allLines = [allText componentsSeparatedByString:@"\n"];
    NSArray *inputs = [[allLines objectAtIndex:0] componentsSeparatedByString:@" "];
    
    NSInteger month = [[inputs objectAtIndex:0] intValue];
    NSInteger day = [[inputs objectAtIndex:1] intValue];
    
    NSString *s = @"";
    
    if (month == day) {
        s = [NSString stringWithFormat:@"%ld", month];
    } else  {
        s = [NSString stringWithFormat:@"%ld", month - 1];
    }
    
    [[NSFileHandle fileHandleWithStandardOutput] writeData: [s dataUsingEncoding:NSUTF8StringEncoding]];
    
    return 0;
}
