#!/usr/bin/env python3 from math import inf n, m = map(int, input().split()) a = input().strip() b = input().strip() best_score = (-1, -1, 0, 0) for shift in range(-n+1, m-1): min_score = inf, 0 score = 0 for i in range(max(0, -shift), min(n, m-shift)): score += 4*(a[i] == b[i+shift])-2 if score - min_score[0] > best_score[0]: best_score = (score - min_score[0], shift, min_score[1]+1, i) if score < min_score[0]: min_score = score, i print(" ".join(map(str, best_score)))