def main
  m, n = STDIN.gets.chomp.split
  unique_paths_with_obstacles(m, n)
end
 
def unique_paths_with_obstacles(m, n)
  dp = Array.new(m, 0) { Array.new(n, 0) }
  dp[0][0] = 1
    
  (0...m).each do |i|
    (0...n).each do |j|
      next if obstacle_grid[i][j] == 1
 
        dp[i][j] = dp[i-1][j]+dp[i][j-1] if dp[i][j] == 0
    end
  end
  dp[m-1][n-1]
end
 
puts main