Given a 2D grid represented as a list of lists, where 0 represents an open cell and 1 represents a wall, implement a BFS algorithm to find the shortest path from the top-left corner (0, 0) to the bottom-right corner (n-1, m-1). If no path exists, return -1.
def shortest_path_bfs(grid):